package com.zpark.exception;

import com.zpark.status.StatusCode;

/**
 * 自定义业务异常
 */
public class BusinessException extends RuntimeException {
    private final int code;  // 异常状态码

    public BusinessException(StatusCode statusCode) {
        super(statusCode.getMessage());
        this.code = statusCode.getCode();
    }

    public BusinessException(int code, String message) {
        super(message);
        this.code = code;
    }

    public BusinessException(StatusCode statusCode, String message) {
        super(message);
        this.code = statusCode.getCode();
    }

    // Getter 方法
    public int getCode() {
        return code;
    }
}
